package map.beans;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;

@Entity
@Table(name="GENERAL_CONFIG")
public class GeneralConfigBean implements Serializable {
	private static final long serialVersionUID = 1605691355063297901L;	

	@Id @GeneratedValue
	private Long id;
	
	@NotNull
	@DecimalMax("180.0")
	@DecimalMin("-180.0")
	@Column(name="latitude")
	private double lat;
	@NotNull
	@DecimalMax("90.0")
	@DecimalMin("-90.0")
	@Column(name="longitude")
	private double lon;
	@Column(name="scale")
	private double scale;	

	public GeneralConfigBean() {
		super();
	}

	public GeneralConfigBean(double lat, double lon, double scale) {
		super();
		this.lat = lat;
		this.lon = lon;
		this.scale = scale;
	}	
	
	public Long getId() {
		return this.id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public double getLat() {
		return lat;
	}

	public void setLat(double lat) {
		this.lat = lat;
	}

	public double getLon() {
		return lon;
	}

	public void setLon(double lon) {
		this.lon = lon;
	}

	public double getScale() {
		return scale;
	}

	public void setScale(double scale) {
		this.scale = scale;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();

		sb.append("id: "				+ "\"" + String.valueOf(this.id) 		+ "\",");
		sb.append("lat: "				+ "\"" + String.valueOf(this.lat) 		+ "\",");
		sb.append("lon: "         		+ "\"" + String.valueOf(this.lon) 		+ "\",");
		sb.append("scale: "         	+ "\"" + String.valueOf(this.scale) 	+ "\"");
		
		return sb.toString();
	}

}